"use strict";

class ResolverLogPlugin {
  /**
   * @param {import("@rspack/core").Compiler} compiler
   */
  apply(compiler) {
    compiler.hooks.normalModuleFactory.tap(
      "ResolverLogPlugin",
      (normalModuleFactory) => {
        normalModuleFactory.hooks.resolve.tap("ResolverLogPlugin", (data) => {
          // 重定向模块
          console.log("resolve", JSON.stringify(data, null, 2));
        });
      },
    );
  }
}

module.exports = { ResolverLogPlugin };
